A nonvolatile storage module having a rewritable nonvolatile memory, which is typified by a semiconductor memory card, has been increasingly demanded as a removable storage device. Although the semiconductor memory card is much more expensive than an optical disc or a tape media, due to small size, light weight, seismicity and convenience in handling, it is in great demand as a recording medium for portable devices such as digital still cameras and mobile phones. In recent years, with an increase in capacity of the semiconductor memory card, application of the memory card to an alternative device for a hard disc of a personal computer and recording media for a digital television has been considered.
The semiconductor memory card includes a flash memory as a nonvolatile main memory and a memory controller for controlling the memory. According to instructions for reading and writing from the access module of the digital still camera and the personal computer, the memory controller controls reading and writing with respect to the flash memory. Some non-removable nonvolatile storage modules are incorporated into the digital still camera and a portable audio equipment itself.
Since the flash memory requires a relatively long time to writing and erasing to and from a memory cell array as a storage unit, data in a plurality of memory cells can be collectively erased and written. Specifically, the flash memory includes a plurality of physical blocks and each physical block includes a plurality of pages. Erasure from the flash memory is performed in units of physical blocks and writing to the flash memory is performed in units of pages.
In recent years, in response to demands for larger capacity and lower costs, a multi-level NAND flash memory which can store information of two bits in one memory cell as one type of the flash memory has become a mainstream of the flash memory. In the multi-level NAND flash memory, it is difficult to ensure reliability of the memory cell and therefore, the number of times of rewriting is small. A conventional binary NAND flash memory has the guaranteed number of times of rewriting of 100 thousand and guaranteed data retention time of 10 years. The multi-level NAND flash memory has the guaranteed number of times of rewriting of 10 thousand or less and as shown in, for example, FIG. 1, trades off the number of times of rewriting for the data retention time.
The above-mentioned number of times of rewriting and data retention time are directly connected to the lifetime of the nonvolatile storage module such as the semiconductor memory card and lifetime of the nonvolatile storage system including the nonvolatile storage module.
To extend the lifetime as long as possible, the conventional flash memory employs an address management method called as wear leveling in which rewriting does not concentrate on a particular physical block. For example, in Patent document 1, in writing of data, the data is written to a free physical block as a free area. At this time, when old data corresponding to the logical address is stored, the old data stored in the physical block is erased and the physical block is managed as a free block. This way is figured out so as not to concentrate writing on the particular physical block. This is a method of writing data to the free area, holding the old data until completion of data writing and using the free area including a spare area for replacement of a bad block to perform wear leveling.
However, in a nonvolatile semiconductor memory device in Patent document 1, when the number of remaining free blocks becomes smaller, in a case where data at a certain logical address is rewritten many times, the data is frequently moved between the free block and physical block to which the data at the logical address is allocated. In other words, the number of times of rewriting of the certain physical block (hereinafter referred to as alternate processing) increases rapidly. This phenomenon is hereinafter referred to as “localization of alternate area”.
To address this problem, for example, in a semiconductor disc device in Patent document 2, the number of times of rewriting of each physical block is held and data is swapped based on the number of times of rewriting. Specifically, in rewriting data (data X), a physical block (physical block A) which stores an old version of the data X therein is erased and rewritten. In a case where the number of times of rewriting of the physical block A is large, the data X is written to another physical block (physical block B) with the small number of times of rewriting. However, when data Y has been already stored in the physical block B, the original data X in the physical block A is erased and then, the data Y is moved to the physical block A. After that, new data X is written to the physical block B. In this manner, when the data X is updated thereafter, the physical block B is rewritten. As described above, dynamic wear leveling is achieved by performing swap between the physical blocks A and B based on the number of times of rewriting.    Patent document 1: Japanese Unexamined Patent Publication No. 2003-263894    Patent document 2: Japanese Unexamined Patent Publication No. 1993-282880